﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;


namespace Rizmar
{
    public class Titulo : Panel
    {
        public Label labelId;
        public TextBox textBoxDeságio;
        public Label labelDeságio;
        public TextBox textBoxLíquido;
        public Label labelLíquido;
        public TextBox textBoxDias;
        public Label labelDias;
        public TextBox textBoxD;
        public Label labelD;
        public DateTimePicker dateTimePickerVencimento;
        public Label labelVencimento;
        public DateTimePicker dateTimePickerDataBase;
        public Label labelDataBase;
        public Button buttonPesquisarSacado;
        public TextBox textBoxSacado;
        public Label labelSacado;
        public ComboBox comboBoxCpfCnpj;
        public TextBox textBoxBanco;
        public Label labelCpfCnpj;
        public MaskedTextBox textBoxCpfCnpj;
        public Label labelBanco;
        public ComboBox comboBoxTipo;
        public Label labelTipo;
        public TextBox textBoxValor;
        public TextBox textBoxNum;
        public Label labelValor;
        public Label labelNum;
        public Label labelCodigoSacado;

       public Titulo() 
       {
            labelId = new Label();
            textBoxDeságio = new TextBox();
            labelDeságio = new Label();
            textBoxLíquido = new TextBox();
            labelLíquido = new Label();
            textBoxDias = new TextBox();
            labelDias = new Label();
            textBoxD = new TextBox();
            labelD = new Label();
            dateTimePickerVencimento = new DateTimePicker();
            labelVencimento = new Label();
            dateTimePickerDataBase = new DateTimePicker();
            labelDataBase = new Label();
            buttonPesquisarSacado = new Button();
            textBoxSacado = new TextBox();
            labelSacado = new Label();
            comboBoxCpfCnpj = new ComboBox();
            textBoxBanco = new TextBox();
            labelCpfCnpj = new Label();
            textBoxCpfCnpj = new MaskedTextBox();
            labelBanco = new Label();
            comboBoxTipo = new ComboBox();
            labelTipo = new Label();
            textBoxValor = new TextBox();
            textBoxNum = new TextBox();
            labelValor = new Label();
            labelNum = new Label();
            labelCodigoSacado = new Label();
            // 
            // labelId
            // 
            labelId.AutoSize = true;
            labelId.Location = new System.Drawing.Point(20, 13);
            labelId.Name = "labelId";
            labelId.Size = new System.Drawing.Size(21, 13);
            labelId.TabIndex = 27;
            labelId.Text = "ID:";
            // 
            // textBoxDeságio
            // 
            textBoxDeságio.Location = new System.Drawing.Point(453, 79);
            textBoxDeságio.Name = "textBoxDeságio";
            textBoxDeságio.Size = new System.Drawing.Size(42, 20);
            textBoxDeságio.TabIndex = 26;
            // 
            // labelDeságio
            // 
            labelDeságio.AutoSize = true;
            labelDeságio.Location = new System.Drawing.Point(450, 63);
            labelDeságio.Name = "labelDeságio";
            labelDeságio.Size = new System.Drawing.Size(49, 13);
            labelDeságio.TabIndex = 25;
            labelDeságio.Text = "Deságio:";
            // 
            // textBoxLíquido
            // 
            textBoxLíquido.Location = new System.Drawing.Point(518, 79);
            textBoxLíquido.Name = "textBoxLíquido";
            textBoxLíquido.Size = new System.Drawing.Size(42, 20);
            textBoxLíquido.TabIndex = 24;
            // 
            // labelLíquido
            // 
            labelLíquido.AutoSize = true;
            labelLíquido.Location = new System.Drawing.Point(515, 62);
            labelLíquido.Name = "labelLíquido";
            labelLíquido.Size = new System.Drawing.Size(44, 13);
            labelLíquido.TabIndex = 23;
            labelLíquido.Text = "Liquido:";
            // 
            // textBoxDias
            // 
            textBoxDias.Location = new System.Drawing.Point(405, 79);
            textBoxDias.Name = "textBoxDias";
            textBoxDias.Size = new System.Drawing.Size(24, 20);
            textBoxDias.TabIndex = 22;
            // 
            // labelDias
            // 
            labelDias.AutoSize = true;
            labelDias.Location = new System.Drawing.Point(402, 62);
            labelDias.Name = "labelDias";
            labelDias.Size = new System.Drawing.Size(31, 13);
            labelDias.TabIndex = 21;
            labelDias.Text = "Dias:";
            // 
            // textBoxD
            // 
            textBoxD.Location = new System.Drawing.Point(538, 26);
            textBoxD.Name = "textBoxD";
            textBoxD.Size = new System.Drawing.Size(28, 20);
            textBoxD.TabIndex = 20;
            // 
            // labelD
            // 
            labelD.AutoSize = true;
            labelD.Location = new System.Drawing.Point(535, 10);
            labelD.Name = "labelD";
            labelD.Size = new System.Drawing.Size(24, 13);
            labelD.TabIndex = 19;
            labelD.Text = "D+:";
            // 
            // textBoxVencimento
            // 
            dateTimePickerVencimento.Location = new System.Drawing.Point(305, 78);
            dateTimePickerVencimento.Name = "textBoxVencimento";
            dateTimePickerVencimento.Size = new System.Drawing.Size(77, 20);
            dateTimePickerVencimento.TabIndex = 18;
            dateTimePickerVencimento.Format = DateTimePickerFormat.Short;
            // 
            // labelVencimento
            // 
            labelVencimento.AutoSize = true;
            labelVencimento.Location = new System.Drawing.Point(302, 61);
            labelVencimento.Name = "labelVencimento";
            labelVencimento.Size = new System.Drawing.Size(66, 13);
            labelVencimento.TabIndex = 17;
            labelVencimento.Text = "Vencimento:";
            // 
            // textBoxDataBase
            // 
            dateTimePickerDataBase.Location = new System.Drawing.Point(205, 79);
            dateTimePickerDataBase.Name = "textBoxDataBase";
            dateTimePickerDataBase.Size = new System.Drawing.Size(77, 20);
            dateTimePickerDataBase.TabIndex = 16;
            dateTimePickerDataBase.Format = DateTimePickerFormat.Short;
            // 
            // labelDataBase
            // 
            labelDataBase.AutoSize = true;
            labelDataBase.Location = new System.Drawing.Point(202, 62);
            labelDataBase.Name = "labelDataBase";
            labelDataBase.Size = new System.Drawing.Size(60, 13);
            labelDataBase.TabIndex = 15;
            labelDataBase.Text = "Data Base:";
            // 
            // buttonPesquisarSacado
            // 
            buttonPesquisarSacado.Location = new System.Drawing.Point(484, 24);
            buttonPesquisarSacado.Name = "buttonPesquisarSacado";
            buttonPesquisarSacado.Size = new System.Drawing.Size(31, 23);
            buttonPesquisarSacado.TabIndex = 14;
            buttonPesquisarSacado.Text = "...";
            buttonPesquisarSacado.UseVisualStyleBackColor = true;
            // 
            // textBoxSacado
            // 
            textBoxSacado.Location = new System.Drawing.Point(379, 27);
            textBoxSacado.Name = "textBoxSacado";
            textBoxSacado.Size = new System.Drawing.Size(100, 20);
            textBoxSacado.ReadOnly = true;
            textBoxSacado.TabIndex = 10;
            // 
            // labelSacado
            // 
            labelSacado.AutoSize = true;
            labelSacado.Location = new System.Drawing.Point(376, 10);
            labelSacado.Name = "labelSacado";
            labelSacado.Size = new System.Drawing.Size(47, 13);
            labelSacado.TabIndex = 9;
            labelSacado.Text = "Sacado:";
            // 
            // comboBoxCpfCnpj
            // 
            comboBoxCpfCnpj.FormattingEnabled = true;
            comboBoxCpfCnpj.Items.AddRange(new object[] { "CPF", "CNPJ" });
            comboBoxCpfCnpj.Location = new System.Drawing.Point(23, 79);
            comboBoxCpfCnpj.Name = "comboBoxCpfCnpj";
            comboBoxCpfCnpj.Size = new System.Drawing.Size(50, 21);
            comboBoxCpfCnpj.TabIndex = 11;
            comboBoxCpfCnpj.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxCpfCnpj.Text = "CPF";
            // 
            // textBoxBanco
            // 
            textBoxBanco.Location = new System.Drawing.Point(279, 26);
            textBoxBanco.Name = "textBoxBanco";
            textBoxBanco.Size = new System.Drawing.Size(77, 20);
            textBoxBanco.TabIndex = 8;
            // 
            // labelCpfCnpj
            // 
            labelCpfCnpj.AutoSize = true;
            labelCpfCnpj.Location = new System.Drawing.Point(20, 62);
            labelCpfCnpj.Name = "labelCpfCnpj";
            labelCpfCnpj.Size = new System.Drawing.Size(62, 13);
            labelCpfCnpj.TabIndex = 12;
            labelCpfCnpj.Text = "CPF/CNPJ:";
            // 
            // textBoxCpfCnpj
            // 
            textBoxCpfCnpj.Location = new System.Drawing.Point(93, 79);
            textBoxCpfCnpj.Name = "textBoxCpfCnpj";
            textBoxCpfCnpj.Size = new System.Drawing.Size(89, 20);
            textBoxCpfCnpj.TabIndex = 13;
            textBoxCpfCnpj.Mask = "000.000.000-00";
            // 
            // labelBanco
            // 
            labelBanco.AutoSize = true;
            labelBanco.Location = new System.Drawing.Point(276, 11);
            labelBanco.Name = "labelBanco";
            labelBanco.Size = new System.Drawing.Size(41, 13);
            labelBanco.TabIndex = 7;
            labelBanco.Text = "Banco:";
            // 
            // comboBoxTipo
            // 
            comboBoxTipo.FormattingEnabled = true;
            comboBoxTipo.Location = new System.Drawing.Point(220, 27);
            comboBoxTipo.Name = "comboBoxTipo";
            comboBoxTipo.Size = new System.Drawing.Size(36, 21);
            comboBoxTipo.Items.AddRange(new Object[] { "C","D" });
            comboBoxTipo.TabIndex = 6;
            comboBoxTipo.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxTipo.Text = "C";
            // 
            // labelTipo
            // 
            labelTipo.AutoSize = true;
            labelTipo.Location = new System.Drawing.Point(217, 13);
            labelTipo.Name = "labelTipo";
            labelTipo.Size = new System.Drawing.Size(31, 13);
            labelTipo.TabIndex = 5;
            labelTipo.Text = "Tipo:";
            // 
            // textBoxValor
            // 
            textBoxValor.Location = new System.Drawing.Point(157, 27);
            textBoxValor.Name = "textBoxValor";
            textBoxValor.Size = new System.Drawing.Size(40, 20);
            textBoxValor.TabIndex = 4;
            // 
            // textBoxNum
            // 
            textBoxNum.Location = new System.Drawing.Point(64, 28);
            textBoxNum.Name = "textBoxNum";
            textBoxNum.Size = new System.Drawing.Size(70, 20);
            textBoxNum.TabIndex = 3;
            // 
            // labelValor
            // 
            labelValor.AutoSize = true;
            labelValor.Location = new System.Drawing.Point(154, 12);
            labelValor.Name = "labelValor";
            labelValor.Size = new System.Drawing.Size(80, 13);
            labelValor.TabIndex = 2;
            labelValor.Text = "Valor: ";
            // 
            // labelNum
            // 
            labelNum.AutoSize = true;
            labelNum.Location = new System.Drawing.Point(61, 12);
            labelNum.Name = "labelNum";
            labelNum.Size = new System.Drawing.Size(32, 13);
            labelNum.TabIndex = 0;
            labelNum.Text = "Num:";
            // 
            // labelCodigoSacado
            // 
            labelCodigoSacado.Name = "labelCodigoSacado";
            labelCodigoSacado.Visible = false;
            //
            //Panel
            //
            AccessibleRole = AccessibleRole.DropList;
            BorderStyle = BorderStyle.FixedSingle;
            BackColor = System.Drawing.Color.White;
            Controls.Add(labelId);
            Controls.Add(textBoxDeságio);
            Controls.Add(labelDeságio);
            Controls.Add(textBoxLíquido);
            Controls.Add(labelLíquido);
            Controls.Add(textBoxDias);
            Controls.Add(labelDias);
            Controls.Add(textBoxD);
            Controls.Add(labelD);
            Controls.Add(dateTimePickerVencimento);
            Controls.Add(labelVencimento);
            Controls.Add(dateTimePickerDataBase);
            Controls.Add(labelDataBase);
            Controls.Add(buttonPesquisarSacado);
            Controls.Add(textBoxSacado);
            Controls.Add(labelSacado);
            Controls.Add(comboBoxCpfCnpj);
            Controls.Add(textBoxBanco);
            Controls.Add(labelCpfCnpj);
            Controls.Add(textBoxCpfCnpj);
            Controls.Add(labelBanco);
            Controls.Add(comboBoxTipo);
            Controls.Add(labelTipo);
            Controls.Add(textBoxValor);
            Controls.Add(textBoxNum);
            Controls.Add(labelValor);
            Controls.Add(labelNum);
            Controls.Add(labelCodigoSacado);
            Name = "panel";
            Size = new System.Drawing.Size(629, 114);
            TabIndex = 2;
        }
        public void setPanelLocation(System.Drawing.Point ponto)
        {
            Location = ponto;
        }
        public void setButtonPesquisaSacadoClick(EventHandler e)
        {
            buttonPesquisarSacado.Click += e;
        }

        public void setEventHandlerLeave (TextBox c, EventHandler e) {
            c.Leave += e;
        }

        public void setEventHandlerTextBoxNumTextChanged(EventHandler e)
        {
            textBoxNum.TextChanged += e;
        }


        public bool tituloVazio() {
            if (textBoxNum.Text == "" || textBoxBanco.Text == "" || textBoxDeságio.Text == "" || textBoxCpfCnpj.Text == "" || dateTimePickerDataBase.Text == "" || textBoxDias.Text == "" || textBoxLíquido.Text == "" || textBoxSacado.Text == "" || textBoxValor.Text == "" || dateTimePickerVencimento.Text == "")
                    return true;
            return false;
        }

        public void setSacadoTextBox(string texto) 
        {
            textBoxSacado.Text = texto;
        }


        public void setTextBoxReadOnly(TextBox t, bool p)
        {
            t.ReadOnly = p;
        }

        public String getTextBoxBancoText()
        {
          return textBoxBanco.Text;
        }
    
        public string getTextBoxNumText()
        {
 	      return textBoxNum.Text;
        }

        public string getTextBoxCpfCnpjText()
        {
            return textBoxCpfCnpj.Text;
        }

        public DateTime getTextBoxVencimentoText() 
        {
            return Convert.ToDateTime(dateTimePickerVencimento.Text);
        }

        public DateTime getTextBoxDataBaseText() 
        {
            return Convert.ToDateTime(dateTimePickerDataBase.Text);
        }

        public decimal getTextBoxValorText() 
        {
            return Convert.ToDecimal(textBoxValor.Text);
        }

        public decimal getTextBoxLiquidoText() 
        {
            return Convert.ToDecimal(textBoxLíquido.Text);
        }

        public int getTextBoxDiasText() 
        {
            return Convert.ToInt32(textBoxDias.Text);
        }

        public decimal getTextBoxDesagioText() 
        {
            return Convert.ToDecimal(textBoxDeságio.Text);
        }

        public int getTextBoxDText() 
        {
            return Convert.ToInt32(textBoxD.Text);
        }

        public int getLabelCodigoSacado() 
        {
            return Convert.ToInt32(labelCodigoSacado.Text);
        }

        public void setLabelCodigoSacadoText(string s) 
        {
            labelCodigoSacado.Text = s;
        }

        public void setTextBoxCpfCnpjMask(string s)
        {
            textBoxCpfCnpj.Mask = s;
        }

        public string getComboBoxCpfCnpjText() 
        {
            return comboBoxCpfCnpj.Text;
        }

        public void setComboBoxCpfCnpjMaskTextChanged(EventHandler e)
        {
            comboBoxCpfCnpj.TextChanged += e;
        }
    }

}
